<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Admin</title>
        <link rel='stylesheet' href='../css/reset.css'/>
        <link rel='stylesheet' href='../css/960.css'/>
        <link rel='stylesheet' href='css/style.css'/>
        <script src="../Scripts/jquery-1.8.1.min.js" type="text/javascript"></script>
        <!-- Load TinyMCE -->
        <script type="text/javascript" src="tiny_mce/jquery.tinymce.js"></script>
        <script type="text/javascript">
                $().ready(function() {
                        $('.tinymce_editor').tinymce({
                                // Location of TinyMCE script
                                script_url : 'tiny_mce/tiny_mce.js',

                                // General options
                                theme : "advanced",
                                plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,advlist",

                                // Theme options
                                theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,fontselect,fontsizeselect,|,insertfile,insertimage",
                                theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code",
                                theme_advanced_toolbar_location : "top",
                                theme_advanced_toolbar_align : "center",
                                theme_advanced_statusbar_location : "bottom",
                                theme_advanced_resizing : true,

                                // Replace values for the template plugin
                                template_replace_values : {
                                        username : "Some User",
                                        staffid : "991234"
                                }
                        });
                });
        </script>
        <!-- /TinyMCE -->
    </head>
    <body>
        <div id ="container" class="container_12">
            
            <div id="banner" class="grid_12">
                    <img src='../img/logo.png'>
            </div><!--end banner wrap-->
            
            <div id="body" class="grid_12">
                <div id="siteBar" class="grid_4">
                    <?php
                        include 'siteBar.php';
                    ?>
                </div><!--end siteBar wrap -->
                <div id="main" class="grid_7">
                    <div class="section">
                        <h2>Danh sách tin</h2>
                        <form>
                            <ul>
                                <li class="listitem">
                                    <?php
                                        if(isset($_REQUEST['id']))
                                        {
                                            $id = $_REQUEST['id'];
                                        }
                                        require "DB.php";
                                        $q2 = "SELECT * FROM NEWS WHERE ID = $id" ;
                                        $r2 = mysql_query($q2);
                                        while ($row = mysql_fetch_array($r2))
                                        {
                                            $title = $row["title"];
                                            $description = $row["description"];
                                            $content= $row["content"];
                                            $img = $row["image"];
                                            $type = $row["type"];
                                            
                                            echo "<div class='row'>
                                                    <label for='txtname'>Tiêu đề:</label>
                                                    <input class='textbox' id='txtten' name='nam' type='text' value='$title' maxlength='255'/>
                                                </div>
                                                <div class='row'>
                                                    <label for='txtname'>Mô tả:</label>
                                                    <textarea class='textbox' id='txtmota' name='mota' rows='5' type='text' maxlength='255'/>$description</textarea>
                                                </div>
                                                <div class='row'>
                                                    <label for='txtname'>Bài viết:</label>
                                                </div>
                                                <textarea id='txtcontent' name='baiviet' rows='15' cols='50' class='tinymce_editor'>$content</textarea>
                                                <div class='row'>
                                                    <label for='txtname'>Loại tin tức:</label>
                                                    <select class='textbox' name='matin' id='txttin'>";
                                                            $q = "SELECT * FROM NEWSTYPE";
                                                            $r = mysql_query($q);
                                                            while ($row = mysql_fetch_array($r))
                                                            {
                                                                $ID = $row["ID"];
                                                                $type1 = $row["Type"];
                                                                if($ID == $type)
                                                                    echo "<option value='$ID' selected>$type1</option>";
                                                                else
                                                                    echo "<option value='$ID'>$type1</option>";
                                                            }
                                                echo"</select>
                                                </div>
                                            </li>";
                                        }                                 
                                    ?>   
                                <li class="listitem">
                                    <div class="row rightalign">
                                        <input class="form-button" name="action" type="button" onclick="Modify_Tour_Manager();" value="Cập nhật"/>
                                    </div>
                                    <div id="warning" ></div>
                                </li>    
                            </ul>    
                        </form>
                    </div>
                    <div class="section">
                        <h2>Chức năng</h2>
                        <form>
                            <ul>
                                <li class="listitem">
                                    <div class="row">
                                        <input class="form-button red" type="button" value="Xóa tin tức" onclick="Delete_Tour_Manager();"/>
                                    </div>
                                </li>    
                            </ul>    
                        </form>
                    </div>
                </div><!--end main wrap -->
                
            </div><!--end main wrap-->
            
            <div id="footer" class="grid_12">
            </div><!--end footer wrap-->
        </div><!--end container wrap-->
    </body>
</html>